<template>
  <div class="blog-detail-container">
    <h2>{{ blog.title }}</h2>
    <div class="aside">
      <span>日期：{{ formatDate(blog.createDate) }}</span>
      <span>浏览量：{{ blog.scanNumber }}</span>
      <a href="#Dataform">评论：{{ blog.commentNumber }}</a>
      <Router-link
        :to="{
          name: 'BlogCategory',
          params: {
            categoryId: blog.category.id,
          },
        }"
        >{{ blog.category.name }}</Router-link
      >
    </div>
    <div class="markdown-body" v-html="blog.htmlContent"></div>
    `
  </div>
</template>

<script>
import formatDate from "@/utils/formatDate";
import "highlight.js/styles/github.css";
export default {
  props: {
    blog: {
      type: Object,
      required: true,
    },
  },
  created() {
    console.log(this.blog);
  },
  methods: {
    formatDate,
  },
};
</script>

<style scoped lang="less">
@import "~@/style/var.less";
@import "~@/style/markdown.css";
.aside {
  font-size: 14px;
  color: @gray;
  span,
  a {
    margin-right: 20px;
  }
}
.markdown-body {
  margin: 20px 0;
}
</style>